package net.atomarrow.util.excel;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.util.CellRangeAddress;

public class ObjectData extends BaseData {
	private Object data;
	private String[] columns;
	private Map columnMap;

	public ObjectData(int row, int column, Object data, String[] columns,
			CellStyle CellStyle) {
		super(row, column, CellStyle);
		this.data = data;
		this.columns = columns;
	}

	public ObjectData(int row, int column, Map columnMap, Object data,
			String[] columns, CellStyle cellStyle) {
		this(row, column,data, columns, cellStyle);
		this.columnMap=columnMap;
	}

	@Override
	public List<CellData> getCellDatas(List<CellRangeAddress> regions,
			ExcelFormatListener format,ExcelDataChangeListener dataChanger) {
		ArrayList<CellData> cellDatas = new ArrayList<CellData>();
		addDomainToList(regions,cellDatas,columnMap,data,columns,0,format,dataChanger);
		return cellDatas;
	}

	@Override
	public List<CellData> getCellDatas(List<CellRangeAddress> regions) {
		return getCellDatas(regions, null,null);
	}

	@Override
	public int getEndColumn() {
		return column - 1;
	}

	@Override
	public int getEndRow() {
		return row;
	}

}
